/*设计一个字段存储以下的信息
字体ID：0~255之间的一个数；
字体大小0~127之间的一个数；
对齐：0~2之间的一个数，表示左对齐，居中，右对齐
加粗开1关0
斜体开1关0*/
#include <stdio.h>

#define THIK_OPEN 1
#define THIK_CLOSE 0
#define XIE_OPEN 1
#define XIE_CLOSE 0
#define LEFT 0
#define MIDDLE 1
#define RIGHT 2
void welcom_show(void);
void eatline(void);
void font(void);
void size(void);
void alignment(void);
void bold(void);
void italic(void);
void show_size(void);
struct charat_set
{
	unsigned int id : 8;
	unsigned int size : 7;
	unsigned int duiqi : 2;
	unsigned int jiacu : 1;
	unsigned int xieti : 1;
};
struct charat_set klm;
int main(void)
{
	char judge;
	welcom_show();
	while ((judge = getchar()) != 'q')
	{
		switch (judge)
		{
		case'a':
			font();
			break;
		case'b':
			size();
			break;
		case'c':
			alignment();
			break;
		case'd':
			bold();
			break;
		case'e':
			italic();
			break;
		}
		eatline();
		show_size();
		welcom_show();
	}
}
void welcom_show(void)
{
	puts("***********************************");
	puts("a)changge font     b)change size");
	puts("c)change alignment d)toggle bold");
	puts("e)toggle italic    ");
	puts("q)quit");
}
void eatline(void) 
{
	char ch;
	while ((ch = getchar()) != '\n')
	{
		continue;
	}
}
void font(void)
{
	puts("enter the font you want");
	eatline();
	int fo;
	scanf_s("%d", &fo, 3);
	klm.id = fo;
}
void size(void)
{
	puts("enter the size you want");
	eatline();
	int fo;
	scanf_s("%d", &fo, 3);
	klm.size = fo;
}
void alignment(void)
{
	puts("enter the alignment you want");
	puts("0)left   1)middle    2)right");
	eatline();
	int fo;
	scanf_s("%d", &fo, 1);
	switch (fo)
	{
	case 0:
		klm.duiqi = LEFT;
		break;
	case 1:klm.duiqi = MIDDLE; break;
	case 2:klm.duiqi = RIGHT; break;
	}
}
void bold(void)
{
	puts("enter the bold you want");
	puts("0)close   1)open   ");
	eatline();
	int fo;
	scanf_s("%d", &fo, 1);
	switch (fo)
	{
	case 0:klm.jiacu = THIK_CLOSE;break;
	case 1:klm.jiacu=THIK_OPEN; break;
	}
}
void italic(void)
{
	puts("enter the italic you want");
	puts("0)close   1)open   ");
	eatline();
	int fo;
	scanf_s("%d", &fo, 1);
	switch (fo)
	{
	case 0:
		klm.xieti=XIE_CLOSE;
		break;
	case 1:klm.xieti=XIE_OPEN; break;
	}
}
void show_size(void)
{
	switch (klm.jiacu)
	{
	case THIK_CLOSE:puts("thik_close"); break;
	case THIK_OPEN:puts("thik_open"); break;
	}
}